#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    int dx[4] = { 0,0,1,-1 };
    int dy[4] = { 1,-1,0,0 };

    vector<vector<int> > flipChess(vector<vector<int> >& A, vector<vector<int> >& f) {
        for (auto v : f)
        {
            int a = v[0] - 1, b = v[1] - 1;

            for (int i = 0; i < 4; i++)
            {
                int x = a + dx[i], y = b + dy[i];
                if (x >= 0 && x < 4 && y >= 0 && y < 4)
                {
                    A[x][y] ^= 1;
                }
            }
        }
        return A;
    }
};